package fatec.lp3.ap_sca.model.db.conector;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Calendar;

import fatec.lp3.ap_sca.model.bean.ScaLog;
import fatec.lp3.ap_sca.model.db.dao.LogDAO;

public class FabricaConexoes {

	public static Connection criarConexao() {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Connection conexao = DriverManager.getConnection(
					"jdbc:mysql://localhost/mydb", "root", "root");
			return conexao;
		} catch (Exception e) {
			ScaLog objLog = new ScaLog();
			objLog.setMensagem(e.getMessage());
			objLog.setMetodo("criarConexao");
			objLog.setData(Calendar.getInstance().getTime());
			new LogDAO().inserir(objLog);
		}
		return null;
	}
}
